<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>添加商品</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<link href="../../css/demo.css" rel="stylesheet" type="text/css" />
	<script src="../../js/boot.js" type="text/javascript"></script>
	<script src="../../js/good/good.js" type="text/javascript"></script>
		<script src="../../js/swfupload/swfupload.js" type="text/javascript"></script>
    <style type="text/css">
    html, body
    {
        font-size:12px;
        padding:0;
        margin:0;
        border:0;
        height:100%;
        overflow:hidden;
    }
    </style>
</head>
<body>    
     <!-- 数据获取到以name的方式进行装载装载到相应的位置进行显示 -->
    <form id="form1" method="post"  enctype="multipart/form-data"> 
    	<input name="goodsId" class="mini-hidden" id="goodsId"/>
    	<input name="goodsMainPhoto" class="mini-hidden" id="goodsMainPhoto"/>
    	<input name="goodsDesImg" class="mini-hidden" id="goodsDesImg"/>
        <div style="padding-left:11px;padding-bottom:5px;" >
            <table style="table-layout:fixed;margin-top:20px;align:center">
                 <tr style="padding:10px">
                 	 
                 	<td rowspan="5" colspan="2"  style="padding:10px">
                 		<fieldset style="border:solid 1.2px #aaa;padding:3px;">
            			<legend >商品主图</legend>	
                    	<img id="goodImag" name="goodImag" src="" height="200"></img>
                    	</fieldset>
                    </td>
                    <td>商品名称</td>
                    <td style="padding:10px">    
                        <input name="goodsName" required="true"  style="width:180px"  class="mini-textbox" id="goodsName"/>
                    </td>
                    <td>商品分类</td>
                    <td style="padding:10px">    
                       <input name="goodsClassId" id="goodsClassId"   required="true"  class="mini-combobox" style="width:180px;" textField="className" valueField="classId" emptyText="请选择..."
    url="javascript:getRootPath()+'/rest/goodsClass/list_for_son'"   showNullItem="true" nullItemText="请选择..."/>
                    </td>
                </tr>
                <tr style="padding:10px">
                	<td>商品原价(元)</td>
                    <td style="padding:10px">    
                       <input name="goodsPrice" required="true" value="0.00"  style="width:180px;" vtype="float" class="mini-textbox" id="goodsPrice"/>
                    </td>
                    <td>商品售价(元)</td>
                    <td style="padding:10px">    
                       <input name="goodsStorePrice" required="true"  value="0.00"  style="width:180px;" vtype="float" class="mini-textbox" id="goodsStorePrice"/>
                    </td>
                </tr>
                <tr style="padding:10px">
                	<td>库存数量</td>
                    <td style="padding:10px">    
                       <input name="goodsInventory" required="true" value="0"   style="width:180px;" vtype="int" class="mini-textbox" id="goodsInventory"/>
                    </td>
                    <td>销售数量</td>
                    <td style="padding:10px">    
                       <input name="goodsSalenum" value="0"  style="width:180px;" vtype="int" class="mini-textbox" id="goodsSalenum"/>
                    </td>
                </tr>
                 <tr style="padding:10px">
                	<td>商品浏览量</td>
                    <td style="padding:10px">    
                       <input name="goodsClick" readonly="true"   value="0"   style="width:180px;" vtype="int" class="mini-textbox" id="goodsClick"/>
                    </td>
                    <td>商品收藏量</td>
                    <td style="padding:10px">    
                       <input name="goodsCollect" readonly="true"   value="0"  style="width:180px;" vtype="int" class="mini-textbox" id="goodsCollect"/>
                    </td>
                </tr>
                <tr style="padding:10px">
                	<td>商品货号</td>
                    <td style="padding:10px">    
                       <input name="goodsSerial" required="true"  style="width:180px;"  class="mini-textbox" id="goodsSerial"/>
                    </td>
                    <td>支持货到付款</td>
                    <td style="padding:10px">    
                    	<select name="goodsCod" class="mini-radiobuttonlist" id="goodsCod">
                        	<option value="0">支持</option>
                        	<option value="-1">不支持</option>
                    	</select>
                    </td>
                </tr>
                <tr style="padding:10px">
                	<td>商品状态</td>
                    <td style="padding:10px">    
                       <input name="goodsStatus" id="goodsStatus"  required="true" class="mini-combobox" style="width:170px;" textField="text" valueField="goodStatus" emptyText="请选择..."
    url="good_status.txt"  allowInput="true" showNullItem="true" nullItemText="请选择..."/>
                    </td>
                	<td>是否包邮</td>
                    <td style="padding:10px">    
                       <select name="goodsTransfee" class="mini-radiobuttonlist" id="goodsTransfee">
                        	<option value="0">不包邮</option>
                        	<option value="1">包邮</option>
                    	</select>
                    </td>
                    <td>是否可以聚福</td>
                    <td style="padding:10px">    
                       <select name="goodsCliffordStatus" class="mini-radiobuttonlist" id="goodsCliffordStatus">
                        	<option value="0">不可以聚福</option>
                        	<option value="1">可以聚福</option>
                    	</select>
                    </td>
                </tr>
                 <tr style="padding:10px">
                	<td>参加活动</td>
                    <td style="padding:10px">    
                       <input name="goodsActivityStatus" id="goodsActivityStatus" class="mini-combobox" style="width:170px;" textField="text" valueField="goodStatus" emptyText="请选择..."
    url="good_active.txt"  allowInput="true" showNullItem="true" nullItemText="请选择..."/>
                    </td>
                	<td>选择活动名称</td>
                    <td style="padding:10px">    
                       <input name="goodsActivityId" id="goodsActivityId"  class="mini-combobox" style="width:170px;" textField="activityName" valueField="activityId" emptyText="请选择..."
    url="javascript:getRootPath()+'/rest/activity/list_for_good'"  allowInput="true" showNullItem="true" nullItemText="请选择..."/>
                    </td>
                    <td>商品图片</td>
                    <td style="padding:10px">    
                      <input id="fileupload1" class="mini-fileupload" style="width:180px;" limitSize="1MB"  name="file_upload" limitType="*.jpg;*.JPG;*.jpeg;*.JPEG;*.png;*.PNG;*.bmp;*.BMP" flashUrl="../../js/swfupload/swfupload.swf"
    onuploadsuccess="onUploadSuccess" 
    onuploaderror="onUploadError" onfileselect="onFileSelect"/>
                    </td>
                     <td style="padding:10px">    
                      <input type="button" value="上传" onclick="startUpload(1)"/>
                    </td>
                </tr>
                 <tr style="padding:10px">
                	<td>商品描述</td>
                    <td style="padding:10px" colspan="3">    
                    	<input name="goodsDes" style="width:440px;" emptyText="请输入商品描述。。。"  class="mini-textbox" id="goodsDes"/>
                    </td>
                    <td>商品详细图片</td>
                    <td style="padding:10px">    
                      <input id="fileupload2" class="mini-fileupload" style="width:180px;" limitSize="1MB"  name="file_upload" limitType="*.jpg;*.JPG;*.jpeg;*.JPEG;*.png;*.PNG;*.bmp;*.BMP" flashUrl="../../js/swfupload/swfupload.swf"
    onuploadsuccess="onUploadSuccess1" 
    onuploaderror="onUploadError" onfileselect="onFileSelect"/>
                    </td>
                     <td style="padding:10px">    
                      <input type="button" value="上传" onclick="startUpload(2)"/>
                    </td>
                </tr>
                <tr style="padding:10px">
                	 <td>是否推荐</td>
                    <td style="padding:10px">    
                        <select name="goodsRecommend" class="mini-radiobuttonlist" id="goodsRecommend">
                        	<option value="1">推荐</option>
                        	<option value="0">不推荐</option>
                    	</select>
                    </td>
                    <td>是否刪除</td>
                    <td style="padding:10px">    
                        <select name="disabledState" class="mini-radiobuttonlist" id="disabledState">
                        	<option value="0">刪除</option>
                        	<option value="1">未刪除</option>
                    	</select>
                    </td>
                    
                </tr>
            </table>
        </div>
        <div id="tabs1" class="mini-tabs" activeIndex="0" style="width:100%;height:250px;padding-left:10px;" plain="false">
		    <div title="商品详情" >
		        <textarea  name="goodsDetails"  required="true" style="width:100%;height:100%" id="goodsDetails" class="mini-textarea" emptyText="请输入商品详情。。。"></textarea>
		    </div>
		    <div title="商品包装详情">
		        <textarea  name="goodsPackDetails"   required="true"style="width:100%;height:100%" id="goodsPackDetails" class="mini-textarea" emptyText="请输入商品包装详情。。。"></textarea>
		    </div>
		    <div title="商品售后服务详情">
		        <textarea name="goodsService"  required="true" style="width:100%;height:100%" id="goodsService" class="mini-textarea" emptyText="请输入商品描述。。。"></textarea>
		    </div>
		    <div title="商品详细图片" >
		    	<img id="goodsImgInfo_show" name="goodsImgInfo_show" src="" style="width:100%;height:auto"></img>
		    </div>
		</div>
        <div style="text-align:center;padding:20px;">               
            <a class="mini-button mini-button-primary" onclick="onOk" style="width:160px;margin-right:30px;">新增(更新)商品</a>       
            <a class="mini-button mini-button-primary" onclick="onCancel" style="width:160px;">取     消</a>  
        </div>        
    </form>
    <script type="text/javascript">
        mini.parse();
       	form = new mini.Form("#form1");
       	
      //动态设置url
        var fileupload = mini.get("fileupload1");
        
        var hostUrl = getRootPath();
        fileupload.setUploadUrl(hostUrl+"/rest/upload/file");

        function onFileSelect(e) {
        	
            //alert("选择文件");
        }
        function onUploadSuccess(e) {
        	
        	 var data = eval('(' + e.serverData + ')');
     		$("#goodImag").attr("src", data.errMsg);
        	var goodsMainPhoto = mini.get("goodsMainPhoto");
        	goodsMainPhoto.setValue(data.errMsg);
            this.setText("");
        }
        
        function onUploadSuccess1(e) {
        	
       	 var data = eval('(' + e.serverData + ')');
    	$("#goodsImgInfo_show").attr("src", data.errMsg);
       	var goodsDesImg = mini.get("goodsDesImg");
       	goodsDesImg.setValue(data.errMsg);
           this.setText("");
       }
        function onUploadError(e) {
            alert("上传出错，请重试。" + e.serverData);
        }

        function startUpload(imgId) {
        	var hostUrl = getRootPath();
        	if(imgId == 1){
        		var fileupload = mini.get("fileupload1");
                fileupload.setUploadUrl(hostUrl+"/rest/upload/file");
                fileupload.startUpload();
        	}else if(imgId == 2){
        		var fileupload = mini.get("fileupload2");
        		fileupload.setUploadUrl(hostUrl+"/rest/upload/file");
                fileupload.startUpload();
        	}
        	
        }
        
        function setImgShow(img_src,img_src1) {
        	$("#goodImag").attr("src", img_src);
        	$("#goodsImgInfo_show").attr("src", img_src1);
        }
       
    </script>
</body>
</html>
